<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/common/taglibs.jsp" %>
<div class="main-content">
    <div class="main-content-inner">
        <%@include file="/WEB-INF/common/back/breadcrumb.jsp" %>
        <div class="page-content">
            <form id="addForm" action="${contextPath}/sys/role/save" class="form-horizontal" role="form">
                <%@include file="/WEB-INF/common/back/fragment/add-fragement.jsp" %>
                <div class="space-4"></div>

                <div class="clearfix form-actions">
                    <div class="col-md-offset-3 col-md-9">
                        <button class="btn btn-info" type="button" onclick="saveForm()">
                            <i class="ace-icon fa fa-check bigger-110"></i>
                            保存
                        </button>
                        <button class="btn" type="reset">
                            <i class="ace-icon fa fa-undo bigger-110"></i>
                            重置
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script>
    function saveForm() {
        $("#addForm").ajaxSubmit({
            success: function (result) {
                if (result && result.success) {
                    window.location.href = "${contextPath}/sys/role/home";
                } else {
                    var failMsg = result && G.Lang.isNotEmpty(result.msg) ? result.msg : "网络异常，请稍候再试！";
                    layer.msg(failMsg);
                }
            }, error: function () {
                layer.msg("保存失败!", "网络异常，请稍候再试！");
            }
        });
    }
</script>
